package day1104.demo01;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * @author wql
 * @version 1.0
 * @date 2022/11/4 9:46
 */

public class Test {
    public static void main(String[] args) {
        //静态方法

      List<Integer> list = new ArrayList();
      list.add(1);
        list.add(0);
        list.add(7);
        list.add(6);
        list.add(2);
        //Comparator<Integer> comparator =(o1,o2)-> Integer.compare(o1,o2);
Comparator<Integer> comparator=Integer::compare;
        Collections.sort(list,comparator);
        System.out.println("list = " + list);
    }
}
